/*
package com.liuyu.common.framework.drools;

import org.kie.api.KieServices;
import org.kie.api.command.Command;
import org.kie.api.command.KieCommands;

import java.io.IOException;

*/
/**
 * drools
 *
 * @author: liuyu
 * @date: 2023/5/12 15:30
 * @version: 1
 *//*

public class Drools {
    public static final String SERVER_URL = "http://ip:8180/kie-server/services/rest/server";

    public static final String PASSWORD = "kieserver1!";

    public static final String USERNAME = "kieserver";

    public static final String KIE_CONTAINER_ID = "mytest1_1.0.0-SNAPSHOT";

    public static final String KIE_SESSION_ID = "mytest1";

    public static void main(String[] args) throws IOException {

        // KisService 配置信息设置

        KieServicesConfiguration kieServicesConfiguration =

                KieServicesFactory.newRestConfiguration(SERVER_URL, USERNAME, PASSWORD, 10000L);

        kieServicesConfiguration.setMarshallingFormat(MarshallingFormat.JSON);

        // 创建规则服务客户端

        KieServicesClient kieServicesClient = KieServicesFactory.newKieServicesClient(kieServicesConfiguration);

        RuleServicesClient ruleServicesClient = kieServicesClient.getServicesClient(RuleServicesClient.class);

        // 规则输入条件

        mytestmodel1 mytest = new mytestmodel1();

        mytest.setSex(1);

        // 命令定义，包含插入数据，执行规则

        KieCommands kieCommands = KieServices.Factory.get().getCommands();

        List<Command<?>> commands = new LinkedList<>();

        commands.add(kieCommands.newInsert(mytest, "mytestmodel1"));

        commands.add(kieCommands.newFireAllRules());

        ServiceResponse<ExecutionResults> results = ruleServicesClient.executeCommandsWithResults(KIE_CONTAINER_ID,

                kieCommands.newBatchExecution(commands, KIE_SESSION_ID));

        // 返回值读取

        mytestmodel1 value = (mytestmodel1) results.getResult().getValue("mytestmodel1");

        System.out.println(value.toString());

    }
}
*/
